<template>
  <div class="comp-product-item-layout" @click="onItem">
    <div class="product-item-left" :class="{tour: isTour}">      
      <image class="product-thumb " :src="thumb" :class="{tour: isTour, 'sold-out':soldOut}" mode="aspectFill" />
      <div :class="{'product-thumb':soldOut, 'sold-out':soldOut }">
        <image src="https://imgs.bestwehotel.com/images/inn/1bqDQfy8rQ" class="sold-out-img" />
      </div>
      <!-- <div class="product-tag" v-if="tag"><div class="text">{{ tag }}</div></div> -->
      <div class="product-label" v-if="label">{{ label + '出发' }}</div>
    </div>
    <div class="product-item-right">
      <slot></slot>  
    </div>
  </div>
</template>

<script>
export default {
  name: 'product-normal-layout',
  props: {
    thumb: { type: String, default: '' },
    tag: { type: String, default: '' },
    label: { type: String, default: '' },
    isTour: { type: Boolean, default: false },
    soldOut:  { type: Boolean, default: false },
  },

  methods: {
    onItem(ev) {
      this.$emit('click')
      // gotoDetail
    }
  }
}
</script>

<style lang="less" scoped>
// .soldOut{
//   -webkit-filter: grayscale(100%); /* Chrome, Safari, Opera */
//   filter: grayscale(100%);
// }
  .comp-product-item-layout {
    background-color: #fff;
    display: flex;
    border-radius: 16rpx;
    padding: 16rpx;
    width: 700rpx;
    margin-bottom: 16rpx;
    box-sizing: border-box;

    .sold-out-img{
      width: 132rpx;
      height: 132rpx;
    }

    .product-item-left {
      position: relative;
      left: 0;
      top: 0;
      margin-right: 16rpx;
      width: 204rpx;
      height: 204rpx;
      flex-shrink: 0;
    }
    
    .tour{
      width: 204rpx!important;
      height: 176rpx!important;
    }

    .product-thumb {
      width: 204rpx;
      height: 204rpx;
      display: inline-block;
      border-radius: 8rpx;
      position: absolute;
      left: 0;
      right: 0;
      z-index: 1;
      &.sold-out{
        background: rgba(0,0,0,0.2) !important;
        z-index: 2;
        display: flex;
        justify-content: center;
        align-items: center;
      }
    }
    // .se-div{
    //   display: none;
    // }

    .product-tag {
      position: absolute;
      left: 0;
      top: 0;
      z-index: 2;
      color: #fff;
      text-align: center;
      height: 32rpx;
      line-height: 32rpx;
      border-radius: 8rpx 0 8rpx 0;
      background-color: rgba(0, 0, 0, 0.5);
      padding: 0 12rpx;
      font-size: 20rpx;
      // .text{
      //   transform: scale(0.8)
      // }
    }

    .product-label {
      position: absolute;
      left: 10rpx;
      bottom: 10rpx;
      z-index: 2;
      color: #fff;
      text-align: center;
      height: 40rpx;
      line-height: 40rpx;
      border-radius: 20rpx;
      background-color: rgba(0, 0, 0, 0.5);
      padding: 0 12rpx;
      font-size: 24rpx;
    }

    .product-item-right {
      flex-grow: 1;
      overflow-x: hidden;
    }
  }
</style>